/**
 * 用于获取全局定义的用户信息 
 * 
 * app-key   请求头携带的 app-key
 * ownId     主体id
 * token     请求头携带的token
 * userInfo  本地存储的用户信息
 * viewData  当前可用视图
 */


/**
 * @param {app-key ownId token userInfo viewData} key 
 */
export function getLoginConfig(key) {
    // 从本地读取 key
    let data = localStorage.getItem(key);
    return data;
}

export function setLoginConfig(key, value) {
    // 从本地读取 key
    localStorage.setItem(key, JSON.stringify(value));

}


/**
 *  getAppkey  获取 appkey
 */
export function getAppkey() {
    let data = localStorage.getItem("app-key");
    return data;
}

/**
 *  getAppkeyInfo  获取租户信息
 */
export function getAppkeyInfo() {
    let data = localStorage.getItem("app-key-info");
    return data;
}

/**
 *  getToken  获取 token
 */
export function getToken() {
    let data = localStorage.getItem("token");
    return data;
}

/**
 *  getUserInfo  获取 用户全部信息
 */
export function getUserInfo() {
    let data = JSON.parse(localStorage.getItem("userInfo"));
    return data;
}

/**
 *  getUserId  获取 用户userId
 */
export function getUserId() {
    let data = JSON.parse(localStorage.getItem("userInfo")).userId;
    return data;
}

/**
 *  getOwnId 获取主体 id (桥梁 id) ,分割
 */
export function getOwnId() {
    let data = localStorage.getItem("ownId");
    return data;
}

/**
 *  getOwnInfo 获取主体信息
 *  [
     {
         name:"",
         sname:"",
         id:""
     },{
        name:"",
        sname:"",
        id:""
     }
 ]
 */

export function getOwnInfo() {
    let data = JSON.parse(localStorage.getItem("ownInfo"));
    return data;
}

/**
 * getViewData  获取当前可用视图
 */
export function getViewData() {
    let data = JSON.parse(localStorage.getItem("viewData"));
    return data;
}

/**
 * getViewData  获取当前视图
 */
export function getNewView() {
    let data = JSON.parse(localStorage.getItem("newView"));
    return data;
}






